<script setup>
import { message } from "ant-design-vue";
import { ref } from "vue";
import { setServerState } from "@/api/server";
const emit = defineEmits(["finished"]);

const serverId = ref(-1);
const visible = ref(false);
const value = ref("1");

const init = (id) => {
  serverId.value = id;
  visible.value = true;
};
const handleOk = async () => {
  let { data } = await setServerState(serverId.value, value.value);
  message.info(data.message);
  visible.value = false;
  emit("finished");
};

defineExpose({ init });
</script>

<template>
  <a-modal title="Title" v-model:visible="visible" @ok="handleOk">
    服务器ID: {{ serverId }} <br /><br />
    <a-select ref="select" v-model:value="value">
      <a-select-option value="1">等待审核</a-select-option>
      <a-select-option value="2">已通过</a-select-option>
      <a-select-option value="3">已拒绝</a-select-option>
    </a-select>
  </a-modal>
</template>
